{% extends 'common/base.html' %}
{% block title %}
    首页
{% endblock %}
{% block styles %}
{#必须使用super继承父类的所有样式再操作#}
    {{ super() }}
    <link rel="stylesheet" href="{{ url_for('static', filename='myindex/myindex.css') }}">
{% endblock %}
{% block page_content %}
    <div class="row">
        <div class="col-md-1"></div>
        <div class="col-md-10" style="text-align: center">
            {{ wtf.quick_form(form) }}
            <br>
            <div class="mycontent" style="width: 100%;height: 100%;text-align: left;">
                {% for post in posts %}
                    <div class="mynewcontent">
                        <div style="overflow: hidden;">
                            <a href="{{ url_for('user.postinfo',pid=post.id) }}" class="mypost">
                                <p class="postcontent">
                                    {{ post.content }}
                                </p>
{#                                <p class="posttime">发帖时间：{{ moment(post.timestamp).format('LLL') }}</p>#}
{#                                {{ moment(post.timestamp).format('LLL') }}#}
                                <p class="posttime">发帖时间：{{ moment(post.timestamp).fromNow() }}</p>
                            </a>
                            <div class="usericon">
                                <a href="{{ url_for('user.newuserposts',uid=post.user.id) }}">
                                    <img src="{{ url_for('static',filename='upload/'+post.user.icon) }}"
                                     style="width: 64px;"/>
                                </a>
                            </div>
                        </div>
                        <div class="newpostcont">
                            <div class="mybutton" style="color: white;">回复</div>
                            <a href="{{ url_for('user.newuserposts',uid=post.user.id) }}" class="username">
                                <div>发帖人：{{ post.user.username }}<span style="display: none;">{{ post.id }}</span></div>
                            </a>
                        </div>
                        <div class="huifuinput" style="display: none;">
                            <form action="" method="post">
                                <textarea rows="3" cols="20" class="rtext" placeholder="请输入评论内容..."  style="width: 60%;"></textarea><br>
                                <span class="usertrue" style="display: none;">{{ current_user.is_authenticated }}</span>
                                <input type="submit" class="mysubmit" value="评论"/>
                                <input type="reset" name="reset" class="reset" value="清空"/>
                            </form>
                        </div>
                    </div>
                    <br>
                {% endfor %}
            </div>
            {#          分页导航条存放的位置            #}
            {{ pagination_show(pagination,'main.index') }}
        </div>
        <div class="col-md-1"></div>
    </div>
{% endblock %}
{% block scripts %}
    {{ super() }}
{#    注意js文件必须在这里导入，还要指定类型#}
    <script type="text/javascript" src="{{ url_for('static', filename='myindex/myindex.js') }}"></script>
{% endblock %}